package cn.edu.jxau.service.impl;

import cn.edu.jxau.common.User;
import cn.edu.jxau.dao.UserDao;
import cn.edu.jxau.dao.impl.UserDaoImpl;
import cn.edu.jxau.exception.ServiceException;
import cn.edu.jxau.service.UserService;

public class UserServiceImpl implements UserService{

	UserDao userDao = new UserDaoImpl();
	
	@Override
	public User queryUser(User from) {
		User user = userDao.queryUser(from);
		if(user == null) {
			throw new ServiceException("用户名错误!");
		}else if(!user.getPassword().equals(from.getPassword())) {
			throw new ServiceException("密码错误!");
		}
		return user;
	}
}
